﻿#region Copyright Info

// 
// Majesty of Omega - The next evolution of macro management space strategy
// 
// Copyright 2007-2009 André Claaßen
// 
// This file is protected by the terms and conditions of the
// Microsoft Community License (Ms-CL 1.1), a copy of which should
// have been distributed along with this software. If not,
// you may find the license information at the following URL:
// 
// http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx

#endregion

#region

using System.Windows;
using System.Windows.Controls;
using Majesty_of_Omega.Logic.GameConfiguration;
using Majesty_of_Omega.Config;
using Majesty_of_Omega.GUI.Controller;

#endregion

namespace Majesty_of_Omega.GUI.Pages.Setup
{
    /// <summary>
    /// Interaction logic for GameSettings.xaml
    /// </summary>
    public partial class Step3_GameSettings
    {
        private readonly NewGameController _gameController;

        /// <summary>
        /// Constructor for game Settings.
        /// </summary>
        public Step3_GameSettings()
        {
            InitializeComponent();
            LayoutRoot.DataContext = GameConfigurator.GameSettings;
            _gameController = new NewGameController(this);
        }

        /// <summary>
        /// Handles the ClickForward event of the NavigationPanel control. Call CreateNewGame of the game controller.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void NavigationPanel_ClickForward(object sender, RoutedEventArgs e)
        {
            _gameController.CreateNewGame();
        }

        /// <summary>
        /// Handles the SelectionChanged event of the GalaxyConfigurationComboBox control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
        private void GalaxyConfigurationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_gameController != null)
                _gameController.SelectGalaxyConfiguration(
                    (GalaxyConfigurationsGalaxy) GalaxyConfigurationComboBox.SelectedValue);
        }
    }
}